/*****************************************************************************

                 ,//////,   ,////    ,///' /////,
                ///' ./// ///'///  ///,    ,, //
               ///////,  ///,///   '/// //;''//,
             ,///' '///,'/////',/////'  /////'/;,

    Copyright 2010 Marcus Jansson <mjansson256@yahoo.se>

    This file is part of ROSA - Realtime Operating System for AVR32.

    ROSA is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ROSA is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ROSA.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
/* Tab size: 4 */

#ifndef _scheduler_H_
#define _scheduler_H_

#include "kernel/rosa_task.h"

extern tcb * EXECTASK;

/// Choose the highest-priority task in the ready queue. Do a context switch to this task.
/// Note: There should always be an idle-task at the lowest possible priority.
void scheduler(void);

/// Returns the currently executing task
tcb *getCurrentTask(void);

/// Returns the maximum amount of stack memory used by a task
int getMaximumStackUsage(tcb *task);

/// Stops the scheduler
void ROSA_stopScheduler(void);

/// Frees all resources allocated by ROSA
void ROSA_freeAllResources(void);

#endif /* _scheduler_H_ */
